package com.android.ringing.ui;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.Window;
import android.widget.TabHost;

import com.android.ringing.R;
import com.android.ringing.RingingApplication;

public class MainActivity extends TabActivity {
	
	private static final String HOME 	= "HOME_PAGE";
	private static final String SEARCH 	= "SEARCH";
	private static final String RINGING = "RINGING";
	private static final String SYSTEM  = "SYSTEM";
	
	private TabHost mTabHost;
	
	private RingingApplication mRingingApp;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
        
        setContentView(R.layout.tabmain);
        
        mRingingApp = (RingingApplication) getApplication();
        DisplayMetrics dm = new DisplayMetrics();
        this.getWindowManager().getDefaultDisplay().getMetrics(dm);
        mRingingApp.setDensity(dm.density);
        
        
        
    	mTabHost = this.getTabHost();

		mTabHost.addTab(mTabHost.newTabSpec(HOME).setIndicator(
				LayoutInflater.from(this).inflate(R.layout.tab_ind_home, null))
				.setContent(new Intent(this, HomeActivity.class)));

		mTabHost.addTab(mTabHost.newTabSpec(SEARCH).setIndicator(
				LayoutInflater.from(this).inflate(R.layout.tab_ind_search, null))
				.setContent(new Intent(this, SearchActivity.class)));

		mTabHost.addTab(mTabHost.newTabSpec(RINGING).setIndicator(
				LayoutInflater.from(this).inflate(R.layout.tab_ind_ringing, null))
				.setContent(new Intent(this, RingingActivity.class)));
		
		mTabHost.addTab(mTabHost.newTabSpec(SYSTEM).setIndicator(
				LayoutInflater.from(this).inflate(R.layout.tab_ind_system, null))
				.setContent(new Intent(this, SystemActivity.class)));
        
    }
}